package Redis

import (
	"queue/library/Log"
	"time"
)

var Logger *Log.Logger

func NewRedisLogger(filePath, nameFormat, suffix string) {
	if Logger != nil {
		return
	}
	//filePath := "./runtime/redis/"
	//nameFormat:="2006-01-02-15"
	//suffix:=".log"
	date := time.Now().Format(nameFormat)
	fileName := date + suffix
	writer := Log.NewWriter(filePath, fileName)
	Logger = Log.NewLogger(writer, 4, 0, filePath, nameFormat, suffix)
}

func Info(vars ...interface{}) {
	Logger.Write("INFO", vars...)
}
func Error(vars ...interface{}) {
	Logger.Write("ERROR", vars...)
}
func CloseRedisLogger() {
	Logger.Writer.Close()
}
